2018-06-11
Sparse stuff:
Each processor has a specific set of instructions, called Instruction Set Architecture (ISA)
Bit: transistor/switch (on or off)
Assembly language
def. a low-level symbolic code converted by an assembler
ex.
> mov a1, 061h :
load in register a1 the content of memory location of adress 061h
easier to write but codes are extremely long and hard to read and understand
high-level languages
easier to write and read algorithms
> 1972: Dennis Ritchie at Bell telephone
Labs develops the C language
> 1979: Bjarne Stroustrup at Bell Labs
design and implement C++
(C with classes)
More sparse stuff:
compiler: g++
command line debugger: gdb
- not really practical to use
Integrated Development Environment (IDE)
##:- single line:
// - multiple lines:
/* ... */
- single line:
multiple file programs and header files
sparse stuff:
types
porto workshop week
operations for variable modification
prefix and postfix
implicit type conversion
ex.
conditional statement
pointer (dereference operator *)
a pointer is a variable that stores the address of another object
always initialize a pointer, *, with the value zero
pointers can be assigned addresses of other variables via the address-of operator (ampersand) & - the types of the variable and the pointer have to match
exs.
size
- the size of pointer doesn’t depend on its type
arrays
what Stroustroup says about:
declaration
indexes range from 0 to
size-1to access an element use the subscript operator
[]or through a pointer
boundary checking: C/C++ compiler does no boundary check. Using out of range indexes is not detected by compiler and results in computation errors
array list initialization
sizeof an array
returns the number of bytes allocated for the entire array
multidimensional arrays
for readability, use nested curly brackets
pointer arithmetic (with an ex)
Sys.time()## [1] "2018-07-03 21:58:04 +03"